function model = vec2im_model2(model)

% VEC2IM_MODEL Convert vector model to image model
%

if isfield(model,'N') 
    NM = model.N; 
else
    NM = length(model.pvec)/2; 
end
if isfield(model,'pvec')
    vec_ind = model.ix+model.reso*(model.iy-1);
    model.amp1 = zeros(model.reso);
    model.amp2 = zeros(model.reso);
    model.exp = zeros(model.reso);
    model.amp1(vec_ind) = model.pvec(1:NM);
    model.amp2(vec_ind) = model.pvec(NM+1:2*NM);
    model.exp(vec_ind) = model.pvec(2*NM+1:end);
    %model = rmfield(model,'pvec');
end